class CreateComments < ActiveRecord::Migration
  def self.up
    create_table :comments do |t|
      t.column :post_id, :integer, :null => false 
      t.column :name, :string
      t.column :email, :string
      t.column :url, :string
      t.column :body, :text
    end
    
    execute "alter table comments add constraint fk_comments_posts 
      foreign key (post_id) references posts(id)"
    
  end

  def self.down
    drop_table :comments
  end
end
